//
//  FreeManagersTableViewCell.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/8.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "FreeManagersTableViewCell.h"

@implementation FreeManagersTableViewCell
{
    GLGWLabel * storeNamelabel;
    GLGWLabel * saleLabel;
    GLGWLabel * dealLabel;
    GLGWLabel * mainLabel;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        GLGWView * baView = [[GLGWView alloc] initWithInSuperView:self.contentView];
        baView.backgroundColor = [UIColor whiteColor];
        [baView setViewShadowWidth:3.0 theCornerRadius:3.0];
        [baView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.contentView.mas_top).offset(kWidthProportion_In_iPhoneTriploid(20));
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-kWidthProportion_In_iPhoneTriploid(1));
        }];
        
        GLGWLabel *nameLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:baView];
        NSString *str = @"小张店铺  ";
        nameLab.text = str;
        [nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(baView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(baView.mas_top).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(22)));
        }];
        nameLab.attributedText = [GLGWLabel addImageName:@"icon_hehuoren" theImageFram:CGRectMake(0, -3, kWidthProportion_In_iPhoneTriploid(53), kHeightProportion_In_iPhoneTriploid(14)) theTextString:str atImageIndex:str.length];
        storeNamelabel = nameLab;
        
        GLGWLabel *arLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:baView];
        arLab.text = @"北京 朝阳区";
        [arLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(nameLab.mas_left);
            make.top.equalTo(nameLab.mas_bottom).offset(kWidthProportion_In_iPhoneTriploid(9));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
            make.right.equalTo(baView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
        }];
        GLGWLabel *saleLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:baView];
        saleLab.text = @" 在售商品6件";
        saleLab.attributedText = [GLGWLabel addImageName:@"search_sale" theImageFram:CGRectMake(0, -3, kWidthProportion_In_iPhoneTriploid(14), kHeightProportion_In_iPhoneTriploid(14)) theTextString:@" 在售商品6件" atImageIndex:0];
        [saleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(arLab.mas_left);
            make.top.equalTo(arLab.mas_bottom).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
        }];
        saleLabel = saleLab;
        
        GLGWLabel *dealLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:baView];
        dealLab.text = @" 成交66笔";
        dealLab.attributedText = [GLGWLabel addImageName:@"Shape" theImageFram:CGRectMake(0, -3, kWidthProportion_In_iPhoneTriploid(14), kHeightProportion_In_iPhoneTriploid(14)) theTextString:@" 成交66笔" atImageIndex:0];
        [dealLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(saleLab.mas_right).offset(kWidthProportion_In_iPhoneTriploid(20));
            make.centerY.equalTo(saleLab.mas_centerY);
        }];
        dealLabel = dealLab;
        
        GLGWLabel *mainLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:baView];
        mainLab.text = @"主营：热镀锌钢管、直缝焊接钢管、内衬塑复/热镀锌钢管、直缝焊接钢管、内衬塑复/热镀锌钢管钢管、直缝焊接钢管、内衬塑复/热镀锌钢管钢管、直缝焊接钢管、内衬塑复/热镀锌钢管、直缝焊接钢管、内衬塑复/热镀锌钢管、/直缝焊接钢管、内衬塑复/直缝焊接钢管、内衬塑复";
        mainLab.numberOfLines = 2;
        [mainLab mas_updateConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(arLab.mas_left);
            make.top.equalTo(saleLab.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.right.equalTo(baView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.bottom.equalTo(baView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(69));
        }];
        mainLabel = mainLab;
        
        GLGWButton *letBtn = [[GLGWButton alloc] initWithTitle:@"在线沟通" titleLableFont:SYSTEMFONT(12) titleLableColor:[UIColor colorWithHexString:@"#999999"] inSuperView:baView];
        [letBtn setImagePositionWithType:SSImagePositionTypeLeft spacing:10];
        [letBtn setImage:[UIImage imageNamed:@"icon_dianhua"] forState:UIControlStateNormal];
        [letBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(arLab.mas_left);
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(117)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(34)));
            make.bottom.equalTo(@(-kHeightProportion_In_iPhoneTriploid(15)));
        }];
        letBtn.layer.cornerRadius = kHeightProportion_In_iPhoneTriploid(6);
        letBtn.layer.borderWidth = 1;
        letBtn.layer.borderColor = [UIColor colorWithHexString:@"#EAEAEA"].CGColor;
        [letBtn addTarget:self action:@selector(leftAction:) forControlEvents:UIControlEventTouchUpInside];
        
        GLGWButton *ritBtn = [[GLGWButton alloc] initWithTitle:@"进入店铺" titleLableFont:SYSTEMFONT(12) titleLableColor:[UIColor colorWithHexString:@"#999999"] inSuperView:baView];
        [ritBtn setImagePositionWithType:SSImagePositionTypeLeft spacing:10];
        [ritBtn setImage:[UIImage imageNamed:@"icon_dianpu_jinru"] forState:UIControlStateNormal];
        [ritBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(letBtn.mas_right).offset(kWidthProportion_In_iPhoneTriploid(34));
            make.centerY.equalTo(letBtn.mas_centerY);
            make.height.equalTo(letBtn.mas_height);
            make.width.equalTo(letBtn.mas_width);
        }];
        ritBtn.layer.cornerRadius = kHeightProportion_In_iPhoneTriploid(6);
        ritBtn.layer.borderWidth = 1;
        ritBtn.layer.borderColor = [UIColor colorWithHexString:@"#EAEAEA"].CGColor;
        [ritBtn addTarget:self action:@selector(ritAction:) forControlEvents:UIControlEventTouchUpInside];

    }
    return self;
}

- (void)leftAction:(GLGWButton *)sender
{
    if (self.BlockCall) {
        self.BlockCall(sender);
    }
}

- (void)ritAction:(GLGWButton *)sender
{
    if (self.BlockInput) {
        self.BlockInput(sender);
    }
}

@end
